{% extends 'usercenter-base.html' %}
{% block title %}我的教师-慕雪在线网{% endblock %}
{% load static %}
{% block custom_bread %}
      <section>
        <div class="wp">
            <ul  class="crumbs">
                <li><a href="{% url 'index' %}">首页</a>></li>
                <li><a href="{% url 'users:info' %}">个人中心</a>></li>
                <li>我的教师</li>
            </ul>
        </div>
    </section>
{% endblock %}
{% block right %}
       <div class="right" >
            <div class="personal_des Releasecont">
                <div class="head">
                    <h1>我的收藏</h1>
                </div>
            </div>
            <div class="personal_des permessage">
                <div class="head">
                    <ul class="tab_header messagehead">
                     <li class="{% if current_page == "myfavorg" %}active2{% endif %}"><a href="{% url 'users:myfavorg' %}">课程机构</a> </li>
                        <li class="{% if current_page == "myfav_teacher" %}active2{% endif %}"><a href="{% url 'users:myfav_teacher' %}">授课教师 </a></li>
                        <li class="{% if current_page == "myfav_course" %}active2{% endif %}"><a href="{% url 'users:myfav_course' %}">公开课程</a></li>
                    </ul>
                </div>
                <div class="messagelist">
                    {% for fav_teacher in teacher_list %}
                    <div class=" butler_list butler-fav-box">
                        <dl class="des users">
                            <dt>
                                <a href="{% url 'org:teacher_detail' fav_teacher.id%}">
                                    <img width="100" height="100" src="{{ fav_teacher.image.url }}"/>
                                </a>
                            </dt>
                            <dd>
                                <h1>
                                    <a href="{% url 'org:teacher_detail' fav_teacher.id%}">
                                        {{ fav_teacher.name }}<span class="key">认证教师</span>
                                    </a>
                                </h1>
                                <ul class="cont clearfix">
                                    <li class="time">工作年限：<span>{{ fav_teacher.work_year }}年</span></li>
                                    <li class="c7">课程数：<span>{{ fav_teacher.course_set.all.count }}</span></li>
                                </ul>
                                <ul class="cont clearfix">
                                    <li class="time">工作公司：<span>{{ fav_teacher.work_company }}</span></li>
                                    <li class="c7">公司职位：<span>{{ fav_teacher.work_position }}</span></li>
                                </ul>
                            </dd>
                            <div class="delete jsDeleteFav_teacher" data-favid="{{ fav_teacher.id }}"></div>
                        </dl>
                    </div>

                    {% endfor %}

                </div>
            </div>
        </div>
{% endblock %}

{% block custom_js %}
    <script type="text/javascript">
           $(document).ready(function() {
        $('.jsDeleteFav_course').on('click', function () {
            var _this = $(this),
                favid = _this.attr('data-favid');
            alert(favid)
            $.ajax({
                cache: false,
                type: "POST",
                url: "{% url 'op:fav' %}",
                data: {
                    fav_type: 3,
                    fav_id: favid,
                    csrfmiddlewaretoken: '{{ csrf_token }}'
                },
                async: true,
                success: function (data) {
                    Dml.fun.winReload();
                }
            });
        });
    });
    </script>
{% endblock %}



